<template>
    <ul>
        <li v-for="(item, index) in arr" :key="index">
            {{ item }}
            <button @click="arr.splice(index, 1)">删除</button>
        </li>
    </ul>
    <button @click="add">生成</button>
</template>
<script setup>
import { reactive } from 'vue'
const arr = reactive([3])
const add = () => {
    arr.push(Math.floor(Math.random() * 20))
}
</script>
<style scoped>
    
</style>